home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / acpi / toshbright.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2008-10-14  |  694b  |  23 lines

  1. #!/bin/sh
  2.  
  3. test -f /usr/share/acpi-support/key-constants || exit 0
  4.  
  5. BRIGHTNESS=$(( `grep brightness: /proc/acpi/toshiba/lcd | cut -d: -f2` + 0 ))
  6. MAXBRIGHT=$(( `grep brightness_levels: /proc/acpi/toshiba/lcd | cut -d: -f2` - 1 ))
  7.  
  8. if [ "x$1" = "x" ]; then
  9.    echo $BRIGHTNESS / $MAXBRIGHT
  10. elif [ "x$1" = "xdown" ]; then
  11.    if [ "x$BRIGHTNESS" != "x0" ]; then
  12.       BRIGHTNESS=$(( $BRIGHTNESS - 1 ))
  13.       echo 'brightness : '$BRIGHTNESS > /proc/acpi/toshiba/lcd
  14.    fi
  15. elif [ "x$1" = "xup" ]; then
  16.    if [ "x$BRIGHTNESS" != "x$MAXBRIGHT" ]; then
  17.       BRIGHTNESS=$(( $BRIGHTNESS + 1 ))
  18.       echo 'brightness : '$BRIGHTNESS > /proc/acpi/toshiba/lcd
  19.    fi
  20. else
  21.    echo >&2 Unknown argument $1
  22. fi
  23.